rawKeyDown
Type
message
Summary
Sent when the user presses any key.
Syntax
rawKeyDown <pKeyCode>
Description
Handle the rawKeyDown message if you want to intercept raw events from the keyboard, or from a mouse wheel, or if you want to handle keys that aren't mapped to any character.
If the rawKeyDown handler does not pass the message or send it to a further object in the message path, the keypress has no effect. Passing the message allows the keypress to have its normal effect.
A rawKeyDown message is also sent when the user moves the mouse wheel on a scrolling mouse; in this case, the message is sent to the control under the mouse pointer.
If the insertion point is in a field, the entry of typed characters is triggered by the rawKeyDown message. This means that trapping the rawKeyDown message and not Passing it prevents typing from being entered in the field.
On Mac OS systems, no message is sent when a modifier key (Shift, Option, Control, or Command) is pressed, unless another key is pressed along with the modifier key. Mouse wheels do not send a rawKeyDown message on Mac OS systems.
Parameters
Name | Type | Description |
---|---|---|
pKeyCode | The raw keycode of the pressed key. |
Examples
on rawKeyDown theKeyNumber
if theKeyNumber is 65308 then increaseScroll -- mouse wheel down
else if theKeyNumber is 65309 then decreaseScroll -- mouse wheel up
else pass rawKeyDown -- don't forget this!
end rawKeyDown
Related
control structure: pass
function: keysDown
glossary: object, pass, control, focus, active control, event, mouse pointer, field, message path, trap, Mac OS, current card, message, modifier key, handler
keyword: character
message: optionKeyDown
Compatibility and Support
Introduced
LiveCode 1.0
OS
mac
windows
linux
ios
android
Platforms
desktop
server
mobile